﻿<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="Database" 
		   targetNamespace="http://happytemplate.org/demoSchema" 
		   xmlns="http://happytemplate.org/demoSchema" 
		   xmlns:xs="http://www.w3.org/2001/XMLSchema"
		   elementFormDefault="qualified"
		   attributeFormDefault="unqualified">
	
  <xs:element name="Database">
    <xs:complexType>
      <xs:choice minOccurs="1" maxOccurs="unbounded">
        <xs:element name="Table">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="Column" minOccurs="1" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:attribute name="Name" type="xs:string" />
                  <xs:attribute name="DataType" type="xs:string" />
                  <xs:attribute name="PrimaryKey" type="xs:string" />
                  <xs:attribute name="Identity" type="xs:boolean" default="false"/>
                  <xs:attribute name="Length" type="xs:int" default="-1"/>
                  <xs:attribute name="Nullable" type="xs:boolean" default="false"/>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="Name" type="xs:string" />
			<xs:attribute name="Schema" type="xs:string" default="dbo"/>
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema>